<?
session_start();

//conect to mysql
$db = mysql_connect("localhost", "usr_2012_16", "se09member");
if (!$db) {
	print "Error - Could not connect to MySQL";
	exit;
}
// Select the database
$er = mysql_select_db("db_2012_16");
if (!$er) {
	print "Error - Could not select the database db_2012_16";
	exit;
}

$dict_array = $HTTP_RAW_POST_DATA;
$array = explode("\n", $dict_array);
print "$array";
foreach ($array as $item){
    sscanf($item, "%s %s", $goal_char, $goal_key);
    $query = "insert into se_dictionary values ('" . $goal_char . "', '" . $goal_key . "');";
    mysql_query($query);
}
?>
